﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EFCore.IBLL;
using EFCore.IDAL;
using Microsoft.Practices.Unity;

namespace EFCore.BLL
{
   public abstract class BaseBll<T>:IBaseBll<T> where T:class 
   {
       private static readonly object syncRoot = new Object();
       protected IBaseDal<T> baseDAL { get; set; }
       protected IUnityContainer Container { get; set; }

       public BaseBll()
       {
           lock (syncRoot)
           {
               Container = DALFactory.Instance.Container;
               if (Container == null)
               {
                   throw new ArgumentNullException("container", "container没有初始化");
               }
           }
       }

       public BaseBll(IBaseDal<T> dal)
       {
            this.baseDAL = dal;
       }
   }
}
